﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public class Normal
    {
        public string NewNumber(string lastNumber,string str)
        {
            string result = "";
            int year = Convert.ToInt32(lastNumber.Substring(2, 2));
            int month = Convert.ToInt32(lastNumber.Substring(4, 2));
            int log = Convert.ToInt32(lastNumber.Substring(6, 3));
            if (year == Convert.ToInt32(Convert.ToString(DateTime.Now.Year).Substring(2, 2)))
            {

                if (month == Convert.ToInt32(DateTime.Now.Month))
                {
                    log = log + 1;
                    result = str + Convert.ToString(year) + Convert.ToString(month).PadLeft(2, '0') + log.ToString().PadLeft(3, '0');
                }
                else
                {
                    result = str + Convert.ToString(year) + Convert.ToString(month + 1).PadLeft(2, '0') + "001";
                }
            }
            else
            {
                result = str + Convert.ToString(year + 1) + "01" + "001";
            }
            return result;
        }
    }
}
